i = 6
n = 1
while True:
    guss_num = eval(input('请输入要猜的数字(0~9)：'))
    if guss_num != range(0, 10):
        print('输入的格式有误请重输入')
    elif guss_num == i:
        print(f'预测了{n}次,你猜中了!')
        pass
    elif guss_num < i:
        print('遗憾，太小了')
        n += 1
    elif guss_num > i:
        print('遗憾，太大了')
        n += 1
